package oauth

import (
	"context"
	"github.com/gin-gonic/gin"
	"inspector/internal/model/do"
	"inspector/pkg/result"
	"inspector/pkg/validation"
)

func (a *Controller) GetToken(c *gin.Context) {

	var rb do.GetTokenRequest
	if err := validation.ValidateAll(c, &rb); err != nil {
		c.Error(err)
		return
	}
	res, err := a.srv.GetToken(context.TODO(), rb)
	if err != nil {
		c.Error(err)
		return
	}
	result.SendResponse(c, res, nil)

}
